Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add yugabytedb module #2825

Merged
merged 23 commits into from
Oct 18, 2024

Conversation

henripqt
Copy link
Contributor

What does this PR do?

This PR introduces the yugabytedb go module

Why is it important?

There is currently no official yugabytedb test container module for golang

Related issues

No related issue

How to test this PR

cd modules/yugabytedb && make test

@henripqt henripqt requested a review from a team as a code owner October 15, 2024 07:16
Copy link

netlify bot commented Oct 15, 2024

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 2d7a7c7
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/67122056a2b3c7000808e3f2
😎 Deploy Preview https://deploy-preview-2825--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@stevenh stevenh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, here's some initial feedback

modules/yugabytedb/options.go Outdated Show resolved Hide resolved
modules/yugabytedb/yugabytedb.go Outdated Show resolved Hide resolved
modules/yugabytedb/yugabytedb.go Outdated Show resolved Hide resolved
modules/yugabytedb/yugabytedb.go Outdated Show resolved Hide resolved
modules/yugabytedb/yugabytedb_test.go Outdated Show resolved Hide resolved
modules/yugabytedb/yugabytedb_test.go Outdated Show resolved Hide resolved
modules/yugabytedb/yugabytedb_test.go Outdated Show resolved Hide resolved
modules/yugabytedb/yugabytedb_test.go Outdated Show resolved Hide resolved
modules/yugabytedb/examples_test.go Show resolved Hide resolved
modules/yugabytedb/examples_test.go Show resolved Hide resolved
@henripqt henripqt force-pushed the feat/add-yugabytedb-module branch from f4f49e9 to cad9e6a Compare October 15, 2024 16:46
Comment on lines 83 to 88
var (
i int
row = db.QueryRowContext(ctx, "SELECT 1")
)

if err := row.Scan(&i); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: a more idiomatic style, which is less verbose for this is, you could also fold into a single line if you prefer.

Suggested change
var (
i int
row = db.QueryRowContext(ctx, "SELECT 1")
)
if err := row.Scan(&i); err != nil {
var i int
row := db.QueryRowContext(ctx, "SELECT 1")
if err := row.Scan(&i); err != nil {

modules/yugabytedb/options.go Outdated Show resolved Hide resolved
modules/yugabytedb/yugabytedb.go Outdated Show resolved Hide resolved
modules/yugabytedb/yugabytedb.go Outdated Show resolved Hide resolved
modules/yugabytedb/yugabytedb_test.go Outdated Show resolved Hide resolved
modules/yugabytedb/yugabytedb.go Outdated Show resolved Hide resolved
Copy link
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @henripqt, thanks for this new module! I added a few comments after testing this PR locally. It seems there is a race condition that causes the tests to fail if I run them, but they always pass if I debug them step-by-step. So my first impression is that we need a more consistent wait strategy. I have no experience with yugabyte, so I'd appreciate if you could do the research on how to fix that. Can you double check how the Java implementation is building them (here and here)?

Thanks!

docs/modules/yugabytedb.md Show resolved Hide resolved
modules/yugabytedb/yugabytedb_test.go Show resolved Hide resolved
modules/yugabytedb/yugabytedb_test.go Outdated Show resolved Hide resolved
modules/yugabytedb/yugabytedb_test.go Outdated Show resolved Hide resolved
modules/yugabytedb/yugabytedb_test.go Show resolved Hide resolved
modules/yugabytedb/examples_test.go Outdated Show resolved Hide resolved
modules/yugabytedb/examples_test.go Show resolved Hide resolved
Copy link
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left just one final comment regarding the usage of the yugabyte client package. Other than that, and after a thorough review from @stevenh (🙇), this PR LGTM, and it's ready to be merged after that discussion is resolved.

Thank you for your time, and for this new module 🙏

@mdelapenya mdelapenya self-assigned this Oct 17, 2024
@mdelapenya mdelapenya added the enhancement New feature or request label Oct 17, 2024
"refers to unknown field or method: Container.YCQLConfigureClusterConfig"
@mdelapenya
Copy link
Member

@henripqt I added two commits to avoid you the burden of doing it: they just run make tidy and make lint (see last two commits).

I think once the CI passes, we are good to go. Thank you!

Copy link
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your patience during the review 🙇 and for improving the library with this new module 🚀

Copy link
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@mdelapenya mdelapenya merged commit 27f699b into testcontainers:main Oct 18, 2024
120 checks passed
mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Oct 18, 2024
* main:
  feat: add yugabytedb module (testcontainers#2825)
  fix: update module container struct name and missing imports (testcontainers#2831)
mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Oct 18, 2024
* main:
  fix(reaper): refactor to allow retries and fix races (testcontainers#2728)
  chore: update ryuk to 0.10.2 (testcontainers#2833)
  feat: add yugabytedb module (testcontainers#2825)
  fix: update module container struct name and missing imports (testcontainers#2831)
  chore: replace 'assert' with 'require' (testcontainers#2827)
  chore: replace 'assert' with 'require' for critical checks (testcontainers#2824)
  chore: bump ryuk to latest release (testcontainers#2818)
  feat: add require for critical checks (testcontainers#2812)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants